﻿<?php

include_once("./scripts/config.php");
include_once("./scripts/class/gmap.class.php");

include_once("./scripts/function/calcDistance.php");
include_once("./scripts/function/getRoute.php");
include_once("./scripts/function/printArr.php");
include_once("./scripts/function/setCoords.php");
include_once("./scripts/function/sortBlubble.php");
include_once("./scripts/function/sortDistance.php");
include_once("./scripts/function/getBrowser.php");

$inc = explode(";", $_GET["q"]);			# split incoming locations by ";"

echo "<br><b>Starttime:</b> ".date("h:i:s")."<br>";

##--> Startpunkt setzen
$point = setCoords($inc);
$dis = calcDistance($point);
$route = getRoute($dis);
printArr($route);

echo "<br><br>Folgende Route ist zu fahren:";
foreach ($route as $key => $value){
	echo "
		<br>Von ".$dis[$route[$key]]["search"]." nach ".$dis[$route[$key+1]]["search"]."
	";
}
echo $dis[$route[0]]["search"]."<br><br>";


echo "<b>Endtime:</b> ".date("h:i:s");
echo "<hr><b>Look for:</b>";
printArr($inc);
echo "<hr><b>Result in Meters:</b>";
printArr($dis);

?>